from django.conf.urls.defaults import *
from django.conf import settings

# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()

from blog.models import Artigo
from blog.feeds import UltimosArtigos
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
urlpatterns = patterns('',
	(r'^$', 'django.views.generic.date_based.archive_index',
	    {'queryset': Artigo.objects.all(),'date_field': 'publicacao'}),
   url(r'^admin/', include(admin.site.urls)),
    (r'^rss/(?P<url>.*)/$', 'django.contrib.syndication.views.feed',
        {'feed_dict': {'ultimos': UltimosArtigos}}),
    (r'^artigo/(?P<slug>[\w_-]+)/$', 'blog.views.artigo'),
    (r'^media/(.*)$', 'django.views.static.serve',
        {'document_root': settings.MEDIA_ROOT }),
    (r'^contato/$', 'views.contato'),
    (r'^comments/', include('django.contrib.comments.urls')),
    (r'^albuns/$', 'views.albuns'),
    
    (r'^entrar/$', 'django.contrib.auth.views.login', {'template_name': 'entrar.html'}, 'entrar'),
    (r'^sair/$', 'django.contrib.auth.views.logout', {'template_name':'sair.html'}, 'sair'),
    (r'^registrar/$', 'views.registrar', {} , 'registrar'),
   (r'^grappelli/', include('grappelli.urls')),
   )

urlpatterns += staticfiles_urlpatterns()
